:******************************************************************************
:* Database Deployment Script
:******************************************************************************
:* Developer: Dmitry Frenkel (dima.frenkel@ps.net)
:* Copyright (C) 2006, Perot Systems Corporation. All rights reserved.
:******************************************************************************

@cls

@echo off

@echo ************************************************************
@echo * BedControl Database Deployment 
@echo * (C) 2006, Perot Systems Corporation. All rights reserved.
@echo ************************************************************

@echo ************************************************************
@echo * Verifying Command Line Parameters
@echo ************************************************************ 
call Util/ParseConnectionParms %1 %2 %3 %4
IF %errorlevel% LSS 0 GOTO ERRORPARAMS

@echo ************************************************************
@echo * Installing Users and Roles
@echo ************************************************************

osql -S %TargetServerSQL% -d %TargetDB% -i "InitialSetup\InitializeDatabase.sql" -n

call DBDeploy.cmd %1 %2 %3 %4

GOTO END

:ERRORPARAMS
@ECHO  Usage: DBDeploy.cmd ServerName Database Username Password
@ECHO  [ServerName] - name of the database server
@ECHO  [Database] - name of the database
@ECHO  [Username] - db username (empty for trusted connection)
@ECHO  [Password] - password (empty for trusted connections)
:END